import { S } from '../../s';
import { IPSAppCounterRef } from '../../app/control/ipsapp-counter-ref';
import { PSControlContainerImpl } from '../pscontrol-container-impl';
import { IPSSearchBarFilter } from './ipssearch-bar-filter';
import { IPSSearchBarGroup } from './ipssearch-bar-group';
import { IPSSearchBarQuickSearch } from './ipssearch-bar-quick-search';
import { IPSSysSearchBar } from './ipssys-search-bar';

export class PSSysSearchBarImpl
  extends PSControlContainerImpl
  implements IPSSysSearchBar
{
  get codeName(): string {
    return this.M.codeName;
  }

  get groupMoreText(): string {
    return this.M.groupMoreText;
  }

  protected psappcounterref: IPSAppCounterRef;
  getPSAppCounterRef(): IPSAppCounterRef | null {
    return (
      this.psappcounterref ||
      (this.psappcounterref = this.fillObjectModel(
        S._9d,
        this.M.getPSAppCounterRef,
        S._2a9,
      ) as IPSAppCounterRef)
    );
  }

  protected pssearchbarfilters: IPSSearchBarFilter[];
  getPSSearchBarFilters(): IPSSearchBarFilter[] | null {
    return (
      this.pssearchbarfilters ||
      (this.pssearchbarfilters = this.fillChildListModel(
        this.M.getPSSearchBarFilters,
        S._19a,
      ) as IPSSearchBarFilter[])
    );
  }

  findPSSearchBarFilter(objKey: any): IPSSearchBarFilter | null {
    return this.getPSModel5(
      S._19a,
      this.getPSSearchBarFilters(),
      objKey,
    ) as IPSSearchBarFilter;
  }

  protected pssearchbargroups: IPSSearchBarGroup[];
  getPSSearchBarGroups(): IPSSearchBarGroup[] | null {
    return (
      this.pssearchbargroups ||
      (this.pssearchbargroups = this.fillChildListModel(
        this.M.getPSSearchBarGroups,
        S._19b,
      ) as IPSSearchBarGroup[])
    );
  }

  findPSSearchBarGroup(objKey: any): IPSSearchBarGroup | null {
    return this.getPSModel5(
      S._19b,
      this.getPSSearchBarGroups(),
      objKey,
    ) as IPSSearchBarGroup;
  }

  protected pssearchbarquicksearchs: IPSSearchBarQuickSearch[];
  getPSSearchBarQuickSearchs(): IPSSearchBarQuickSearch[] | null {
    return (
      this.pssearchbarquicksearchs ||
      (this.pssearchbarquicksearchs = this.fillChildListModel(
        this.M.getPSSearchBarQuickSearchs,
        S._19e,
      ) as IPSSearchBarQuickSearch[])
    );
  }

  findPSSearchBarQuickSearch(objKey: any): IPSSearchBarQuickSearch | null {
    return this.getPSModel5(
      S._19e,
      this.getPSSearchBarQuickSearchs(),
      objKey,
    ) as IPSSearchBarQuickSearch;
  }

  get quickGroupCount(): number {
    return this.M.quickGroupCount;
  }

  get quickSearchMode(): 0 | 1 | 2 {
    return this.M.quickSearchMode;
  }

  get quickSearchWidth(): number {
    return this.M.quickSearchWidth;
  }

  get searchBarStyle():
    | 'SEARCHBAR'
    | 'SEARCHBAR2'
    | 'MOBSEARCHBAR'
    | 'MOBSEARCHBAR2'
    | 'USER'
    | 'USER2' {
    return this.M.searchBarStyle;
  }

  get enableFilter(): boolean {
    return this.M.enableFilter;
  }

  get enableGroup(): boolean {
    return this.M.enableGroup;
  }

  get enableQuickSearch(): boolean {
    return this.M.enableQuickSearch;
  }

  get mobileSearchBar(): boolean {
    return this.M.mobileSearchBar;
  }
  get cls(): string {
    return 'PSSysSearchBarImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._214 || cls == S._25c || cls == S._25d) return true;
    return super.instanceof(cls);
  }
}
